<template>
    <div class="evaluate-woman">
        <el-form :inline="true" :model="formInline">
            <el-form-item label="昵称">
                <el-input v-model="formInline.nickname" placeholder="评价人昵称/被评价人昵称"></el-input>
            </el-form-item>
            <el-form-item label="评价内容">
                <el-input v-model="formInline.content" placeholder="评价内容"></el-input>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="search">搜索</el-button>
                <el-button type="primary" @click="reset">重置</el-button>
            </el-form-item>
        </el-form>
        <el-table
            :header-cell-style="{color:'#555555'}"
            class="black"
            :data="tableData"
            stripe
            border
            style="width: 100%">
            <el-table-column
                prop="auUsername"
                label="评价人账号"
                align="center">
            </el-table-column>
            <el-table-column
                prop="auNickname"
                label="评价人昵称"
                align="center">
            </el-table-column>
            <el-table-column
                prop="puUsername"
                label="被评价人账号"
                align="center">
            </el-table-column>
            <el-table-column
                prop="puNickname"
                label="被评价人昵称"
                align="center">
            </el-table-column>
            <el-table-column
                prop="content"
                label="评价内容"
                align="center">
            </el-table-column>
            <el-table-column
                prop="createTime"
                label="评价时间"
                align="center">
            </el-table-column>
        </el-table>
        <div class="footer-page">
            <el-pagination
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
                :current-page="page"
                :page-sizes="[10, 20, 50, 100]"
                :page-size="page_size"
                layout="total, sizes, prev, pager, next, jumper"
                :total="total_page">
            </el-pagination>
        </div>
    </div>
</template>

<script>
export default {
    name: 'evaluate-woman',
    data: function () {
        return {
            page: 1,
            page_size: 10,
            total_page: 0,
            formInline: {
                nickname: '',
                content: ''
            },
            params: {
                page: 1,
                limit: 10,
                order: 'asc',
                sex: 1
            },
            tableData: []
        }
    },
    created () {
        // this.tableData = []
    },
    mounted () {
        // 进来页面获数据
        this.getList({params: this.params})
    },
    methods: {
        search () {
            this.page = 1
            this.params['nickname'] = this.formInline.nickname
            this.params['content'] = this.formInline.content
            this.getList({params: this.params})
        },
        reset () {
            this.page = 1
            this.formInline.nickname = ''
            this.formInline.content = ''
            this.params['nickname'] = this.formInline.nickname
            this.params['content'] = this.formInline.content
            this.getList({params: this.params})
        },
        onDelClick (item) {
            this.dialogVisible = true
            this.del_station_id = item.station_id
        },
        onSureClick () {
            this.dialogVisible = false
            this.deleteData(this.del_station_id)
        },
        handleSizeChange (val) {
            this.page = 1
            this.params.page = 1
            this.getList({params: this.params})
        },
        handleCurrentChange (val) {
            this.page = val
            this.params.page = val
            this.getList({params: this.params})
        },
        getList (data) {
            this.tableData = []
            this.$api.evaluate.getEvaluateList(data, res => {
                // 隐藏加载动画
                // this.$vux.loading.hide()
                if (res.code === 200) {
                    let data = res.page.list || []
                    for (let i = 0; i < data.length; i++) {
                        this.tableData.push(data[i])
                    }
                    this.total_page = res.page.totalCount
                    this.page_size = res.page.pageSize
                    this.page = res.page.currPage
                }
            })
        }
    }
}
</script>

<style lang="less" scoped>
    .evaluate-woman {
        position: relative;
        width: 100%;
        height: 100%;
        .margin-bottom-12 {
            margin-bottom: 10px;
        }
        .el-row {
            margin-bottom: 20px;
            &:last-child {
                margin-bottom: 0;
            }
        }
        .el-col {
            border-radius: 4px;
        }
        .grid-content {
            position: relative;
            height: 40px;
        }
        .grid-padding {
            /* padding-left: 20px; */
            padding-right: 20px;
        }
        .grid-title {
            float: left;
            width: 72px;
            height: 40px;
            line-height: 40px;
            font-size: 14px;
            color: #333;
            text-align: center;
        }
        .grid-input {
            float: left;
            width: 130px;
            height: 40px;
            line-height: 40px;
            font-size: 14px;
            color: #333;
            text-align: center;
        }
        .row-bg {
            padding: 10px 0;
            background-color: #f9fafc;
        }
        .footer-page {
            width: 540px;
            margin: 0 auto;
            padding-top: 20px;
        }
    }
</style>
